<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - id:000977,sync:fuzzer2,src:001052.lcov_info_final - include/yaml-cpp/exceptions.h</title>
  <link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../index.html">top level</a> - <a href="index.html">include/yaml-cpp</a> - exceptions.h<span style="font-size: 80%;"> (source / <a href="exceptions.h.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">id:000977,sync:fuzzer2,src:001052.lcov_info_final</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">12</td>
            <td class="headerCovTableEntry">35</td>
            <td class="headerCovTableEntryLo">34.3 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2016-03-13 10:42:47</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">5</td>
            <td class="headerCovTableEntry">61</td>
            <td class="headerCovTableEntryLo">8.2 %</td>
          </tr>
          <tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : #ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66</a>
<span class="lineNum">       2 </span>            : #define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
<span class="lineNum">       3 </span>            : 
<span class="lineNum">       4 </span>            : #if defined(_MSC_VER) ||                                            \
<span class="lineNum">       5 </span>            :     (defined(__GNUC__) &amp;&amp; (__GNUC__ == 3 &amp;&amp; __GNUC_MINOR__ &gt;= 4) || \
<span class="lineNum">       6 </span>            :      (__GNUC__ &gt;= 4))  // GCC supports &quot;pragma once&quot; correctly since 3.4
<span class="lineNum">       7 </span>            : #pragma once
<span class="lineNum">       8 </span>            : #endif
<span class="lineNum">       9 </span>            : 
<span class="lineNum">      10 </span>            : #include &quot;yaml-cpp/mark.h&quot;
<span class="lineNum">      11 </span>            : #include &quot;yaml-cpp/traits.h&quot;
<span class="lineNum">      12 </span>            : #include &lt;stdexcept&gt;
<span class="lineNum">      13 </span>            : #include &lt;string&gt;
<span class="lineNum">      14 </span>            : #include &lt;sstream&gt;
<span class="lineNum">      15 </span>            : 
<span class="lineNum">      16 </span>            : namespace YAML {
<span class="lineNum">      17 </span>            : // error messages
<span class="lineNum">      18 </span>            : namespace ErrorMsg {
<span class="lineNum">      19 </span>            : const char* const YAML_DIRECTIVE_ARGS =
<span class="lineNum">      20 </span>            :     &quot;YAML directives must have exactly one argument&quot;;
<span class="lineNum">      21 </span>            : const char* const YAML_VERSION = &quot;bad YAML version: &quot;;
<span class="lineNum">      22 </span>            : const char* const YAML_MAJOR_VERSION = &quot;YAML major version too large&quot;;
<span class="lineNum">      23 </span>            : const char* const REPEATED_YAML_DIRECTIVE = &quot;repeated YAML directive&quot;;
<span class="lineNum">      24 </span>            : const char* const TAG_DIRECTIVE_ARGS =
<span class="lineNum">      25 </span>            :     &quot;TAG directives must have exactly two arguments&quot;;
<span class="lineNum">      26 </span>            : const char* const REPEATED_TAG_DIRECTIVE = &quot;repeated TAG directive&quot;;
<span class="lineNum">      27 </span>            : const char* const CHAR_IN_TAG_HANDLE =
<span class="lineNum">      28 </span>            :     &quot;illegal character found while scanning tag handle&quot;;
<span class="lineNum">      29 </span>            : const char* const TAG_WITH_NO_SUFFIX = &quot;tag handle with no suffix&quot;;
<span class="lineNum">      30 </span>            : const char* const END_OF_VERBATIM_TAG = &quot;end of verbatim tag not found&quot;;
<span class="lineNum">      31 </span>            : const char* const END_OF_MAP = &quot;end of map not found&quot;;
<span class="lineNum">      32 </span>            : const char* const END_OF_MAP_FLOW = &quot;end of map flow not found&quot;;
<span class="lineNum">      33 </span>            : const char* const END_OF_SEQ = &quot;end of sequence not found&quot;;
<span class="lineNum">      34 </span>            : const char* const END_OF_SEQ_FLOW = &quot;end of sequence flow not found&quot;;
<span class="lineNum">      35 </span>            : const char* const MULTIPLE_TAGS =
<span class="lineNum">      36 </span>            :     &quot;cannot assign multiple tags to the same node&quot;;
<span class="lineNum">      37 </span>            : const char* const MULTIPLE_ANCHORS =
<span class="lineNum">      38 </span>            :     &quot;cannot assign multiple anchors to the same node&quot;;
<span class="lineNum">      39 </span>            : const char* const MULTIPLE_ALIASES =
<span class="lineNum">      40 </span>            :     &quot;cannot assign multiple aliases to the same node&quot;;
<span class="lineNum">      41 </span>            : const char* const ALIAS_CONTENT =
<span class="lineNum">      42 </span>            :     &quot;aliases can't have any content, *including* tags&quot;;
<span class="lineNum">      43 </span>            : const char* const INVALID_HEX = &quot;bad character found while scanning hex number&quot;;
<span class="lineNum">      44 </span>            : const char* const INVALID_UNICODE = &quot;invalid unicode: &quot;;
<span class="lineNum">      45 </span>            : const char* const INVALID_ESCAPE = &quot;unknown escape character: &quot;;
<span class="lineNum">      46 </span>            : const char* const UNKNOWN_TOKEN = &quot;unknown token&quot;;
<span class="lineNum">      47 </span>            : const char* const DOC_IN_SCALAR = &quot;illegal document indicator in scalar&quot;;
<span class="lineNum">      48 </span>            : const char* const EOF_IN_SCALAR = &quot;illegal EOF in scalar&quot;;
<span class="lineNum">      49 </span>            : const char* const CHAR_IN_SCALAR = &quot;illegal character in scalar&quot;;
<span class="lineNum">      50 </span>            : const char* const TAB_IN_INDENTATION =
<span class="lineNum">      51 </span>            :     &quot;illegal tab when looking for indentation&quot;;
<span class="lineNum">      52 </span>            : const char* const FLOW_END = &quot;illegal flow end&quot;;
<span class="lineNum">      53 </span>            : const char* const BLOCK_ENTRY = &quot;illegal block entry&quot;;
<span class="lineNum">      54 </span>            : const char* const MAP_KEY = &quot;illegal map key&quot;;
<span class="lineNum">      55 </span>            : const char* const MAP_VALUE = &quot;illegal map value&quot;;
<span class="lineNum">      56 </span>            : const char* const ALIAS_NOT_FOUND = &quot;alias not found after *&quot;;
<span class="lineNum">      57 </span>            : const char* const ANCHOR_NOT_FOUND = &quot;anchor not found after &amp;&quot;;
<span class="lineNum">      58 </span>            : const char* const CHAR_IN_ALIAS =
<span class="lineNum">      59 </span>            :     &quot;illegal character found while scanning alias&quot;;
<span class="lineNum">      60 </span>            : const char* const CHAR_IN_ANCHOR =
<span class="lineNum">      61 </span>            :     &quot;illegal character found while scanning anchor&quot;;
<span class="lineNum">      62 </span>            : const char* const ZERO_INDENT_IN_BLOCK =
<span class="lineNum">      63 </span>            :     &quot;cannot set zero indentation for a block scalar&quot;;
<span class="lineNum">      64 </span>            : const char* const CHAR_IN_BLOCK = &quot;unexpected character in block scalar&quot;;
<span class="lineNum">      65 </span>            : const char* const AMBIGUOUS_ANCHOR =
<span class="lineNum">      66 </span>            :     &quot;cannot assign the same alias to multiple nodes&quot;;
<span class="lineNum">      67 </span>            : const char* const UNKNOWN_ANCHOR = &quot;the referenced anchor is not defined&quot;;
<span class="lineNum">      68 </span>            : 
<span class="lineNum">      69 </span>            : const char* const INVALID_NODE =
<span class="lineNum">      70 </span>            :     &quot;invalid node; this may result from using a map iterator as a sequence &quot;
<span class="lineNum">      71 </span>            :     &quot;iterator, or vice-versa&quot;;
<span class="lineNum">      72 </span>            : const char* const INVALID_SCALAR = &quot;invalid scalar&quot;;
<span class="lineNum">      73 </span>            : const char* const KEY_NOT_FOUND = &quot;key not found&quot;;
<span class="lineNum">      74 </span>            : const char* const BAD_CONVERSION = &quot;bad conversion&quot;;
<span class="lineNum">      75 </span>            : const char* const BAD_DEREFERENCE = &quot;bad dereference&quot;;
<span class="lineNum">      76 </span>            : const char* const BAD_SUBSCRIPT = &quot;operator[] call on a scalar&quot;;
<span class="lineNum">      77 </span>            : const char* const BAD_PUSHBACK = &quot;appending to a non-sequence&quot;;
<span class="lineNum">      78 </span>            : const char* const BAD_INSERT = &quot;inserting in a non-convertible-to-map&quot;;
<span class="lineNum">      79 </span>            : 
<span class="lineNum">      80 </span>            : const char* const UNMATCHED_GROUP_TAG = &quot;unmatched group tag&quot;;
<span class="lineNum">      81 </span>            : const char* const UNEXPECTED_END_SEQ = &quot;unexpected end sequence token&quot;;
<span class="lineNum">      82 </span>            : const char* const UNEXPECTED_END_MAP = &quot;unexpected end map token&quot;;
<span class="lineNum">      83 </span>            : const char* const SINGLE_QUOTED_CHAR =
<span class="lineNum">      84 </span>            :     &quot;invalid character in single-quoted string&quot;;
<span class="lineNum">      85 </span>            : const char* const INVALID_ANCHOR = &quot;invalid anchor&quot;;
<span class="lineNum">      86 </span>            : const char* const INVALID_ALIAS = &quot;invalid alias&quot;;
<span class="lineNum">      87 </span>            : const char* const INVALID_TAG = &quot;invalid tag&quot;;
<span class="lineNum">      88 </span>            : const char* const BAD_FILE = &quot;bad file&quot;;
<span class="lineNum">      89 </span>            : 
<span class="lineNum">      90 </span>            : template &lt;typename T&gt;
<span class="lineNum">      91 </span>            : inline const std::string KEY_NOT_FOUND_WITH_KEY(
<span class="lineNum">      92 </span>            :     const T&amp;, typename disable_if&lt;is_numeric&lt;T&gt; &gt;::type* = 0) {
<span class="lineNum">      93 </span>            :   return KEY_NOT_FOUND;
<span class="lineNum">      94 </span>            : }
<span class="lineNum">      95 </span>            : 
<span class="lineNum">      96 </span>            : inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string&amp; key) {
<span class="lineNum">      97 </span>            :   std::stringstream stream;
<span class="lineNum">      98 </span>            :   stream &lt;&lt; KEY_NOT_FOUND &lt;&lt; &quot;: &quot; &lt;&lt; key;
<span class="lineNum">      99 </span>            :   return stream.str();
<span class="lineNum">     100 </span>            : }
<span class="lineNum">     101 </span>            : 
<span class="lineNum">     102 </span>            : template &lt;typename T&gt;
<span class="lineNum">     103 </span>            : inline const std::string KEY_NOT_FOUND_WITH_KEY(
<span class="lineNum">     104 </span>            :     const T&amp; key, typename enable_if&lt;is_numeric&lt;T&gt; &gt;::type* = 0) {
<span class="lineNum">     105 </span>            :   std::stringstream stream;
<span class="lineNum">     106 </span>            :   stream &lt;&lt; KEY_NOT_FOUND &lt;&lt; &quot;: &quot; &lt;&lt; key;
<span class="lineNum">     107 </span>            :   return stream.str();
<span class="lineNum">     108 </span>            : }
<span class="lineNum">     109 </span>            : }
<span class="lineNum">     110 </span>            : 
<a name="111"><span class="lineNum">     111 </span>            : class Exception : public std::runtime_error {</a>
<span class="lineNum">     112 </span>            :  public:
<a name="113"><span class="lineNum">     113 </span><span class="lineCov">        955 :   Exception(const Mark&amp; mark_, const std::string&amp; msg_)</span></a>
<span class="lineNum">     114 </span><span class="lineCov">        955 :       : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}</span>
<span class="lineNum">     115 </span><span class="lineCov">        955 :   virtual ~Exception() throw() {}</span>
<span class="lineNum">     116 </span>            : 
<span class="lineNum">     117 </span>            :   Mark mark;
<span class="lineNum">     118 </span>            :   std::string msg;
<a name="119"><span class="lineNum">     119 </span>            : </a>
<span class="lineNum">     120 </span>            :  private:
<span class="lineNum">     121 </span><span class="lineCov">        955 :   static const std::string build_what(const Mark&amp; mark,</span>
<span class="lineNum">     122 </span>            :                                       const std::string&amp; msg) {
<span class="lineNum">     123 </span><span class="lineCov">        955 :     if (mark.is_null()) {</span>
<span class="lineNum">     124 </span><span class="lineNoCov">          0 :       return msg.c_str();</span>
<span class="lineNum">     125 </span>            :     }
<span class="lineNum">     126 </span>            : 
<span class="lineNum">     127 </span><span class="lineCov">       1910 :     std::stringstream output;</span>
<span class="lineNum">     128 </span><span class="lineCov">        955 :     output &lt;&lt; &quot;yaml-cpp: error at line &quot; &lt;&lt; mark.line + 1 &lt;&lt; &quot;, column &quot;</span>
<span class="lineNum">     129 </span><span class="lineCov">       1910 :            &lt;&lt; mark.column + 1 &lt;&lt; &quot;: &quot; &lt;&lt; msg;</span>
<span class="lineNum">     130 </span><span class="lineCov">        955 :     return output.str();</span>
<span class="lineNum">     131 </span>            :   }
<a name="132"><span class="lineNum">     132 </span>            : };</a>
<span class="lineNum">     133 </span>            : 
<a name="134"><span class="lineNum">     134 </span><span class="lineCov">        955 : class ParserException : public Exception {</span></a>
<span class="lineNum">     135 </span>            :  public:
<span class="lineNum">     136 </span><span class="lineCov">        955 :   ParserException(const Mark&amp; mark_, const std::string&amp; msg_)</span>
<span class="lineNum">     137 </span><span class="lineCov">        955 :       : Exception(mark_, msg_) {}</span>
<a name="138"><span class="lineNum">     138 </span>            : };</a>
<span class="lineNum">     139 </span>            : 
<a name="140"><span class="lineNum">     140 </span><span class="lineNoCov">          0 : class RepresentationException : public Exception {</span></a>
<span class="lineNum">     141 </span>            :  public:
<span class="lineNum">     142 </span><span class="lineNoCov">          0 :   RepresentationException(const Mark&amp; mark_, const std::string&amp; msg_)</span>
<span class="lineNum">     143 </span><span class="lineNoCov">          0 :       : Exception(mark_, msg_) {}</span>
<span class="lineNum">     144 </span>            : };
<span class="lineNum">     145 </span>            : 
<span class="lineNum">     146 </span>            : // representation exceptions
<span class="lineNum">     147 </span>            : class InvalidScalar : public RepresentationException {
<span class="lineNum">     148 </span>            :  public:
<span class="lineNum">     149 </span>            :   InvalidScalar(const Mark&amp; mark_)
<span class="lineNum">     150 </span>            :       : RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
<span class="lineNum">     151 </span>            : };
<span class="lineNum">     152 </span>            : 
<span class="lineNum">     153 </span>            : class KeyNotFound : public RepresentationException {
<span class="lineNum">     154 </span>            :  public:
<span class="lineNum">     155 </span>            :   template &lt;typename T&gt;
<span class="lineNum">     156 </span>            :   KeyNotFound(const Mark&amp; mark_, const T&amp; key_)
<span class="lineNum">     157 </span>            :       : RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
<span class="lineNum">     158 </span>            :   }
<span class="lineNum">     159 </span>            : };
<span class="lineNum">     160 </span>            : 
<span class="lineNum">     161 </span>            : template &lt;typename T&gt;
<span class="lineNum">     162 </span>            : class TypedKeyNotFound : public KeyNotFound {
<span class="lineNum">     163 </span>            :  public:
<span class="lineNum">     164 </span>            :   TypedKeyNotFound(const Mark&amp; mark_, const T&amp; key_)
<span class="lineNum">     165 </span>            :       : KeyNotFound(mark_, key_), key(key_) {}
<span class="lineNum">     166 </span>            :   virtual ~TypedKeyNotFound() throw() {}
<span class="lineNum">     167 </span>            : 
<span class="lineNum">     168 </span>            :   T key;
<span class="lineNum">     169 </span>            : };
<span class="lineNum">     170 </span>            : 
<span class="lineNum">     171 </span>            : template &lt;typename T&gt;
<span class="lineNum">     172 </span>            : inline TypedKeyNotFound&lt;T&gt; MakeTypedKeyNotFound(const Mark&amp; mark,
<span class="lineNum">     173 </span>            :                                                 const T&amp; key) {
<span class="lineNum">     174 </span>            :   return TypedKeyNotFound&lt;T&gt;(mark, key);
<a name="175"><span class="lineNum">     175 </span>            : }</a>
<span class="lineNum">     176 </span>            : 
<a name="177"><span class="lineNum">     177 </span><span class="lineNoCov">          0 : class InvalidNode : public RepresentationException {</span></a>
<span class="lineNum">     178 </span>            :  public:
<span class="lineNum">     179 </span><span class="lineNoCov">          0 :   InvalidNode()</span>
<span class="lineNum">     180 </span><span class="lineNoCov">          0 :       : RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {}</span>
<a name="181"><span class="lineNum">     181 </span>            : };</a>
<span class="lineNum">     182 </span>            : 
<a name="183"><span class="lineNum">     183 </span><span class="lineNoCov">          0 : class BadConversion : public RepresentationException {</span></a>
<span class="lineNum">     184 </span>            :  public:
<span class="lineNum">     185 </span><span class="lineNoCov">          0 :   explicit BadConversion(const Mark&amp; mark_)</span>
<span class="lineNum">     186 </span><span class="lineNoCov">          0 :       : RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}</span>
<span class="lineNum">     187 </span>            : };
<a name="188"><span class="lineNum">     188 </span>            : </a>
<span class="lineNum">     189 </span>            : template &lt;typename T&gt;
<a name="190"><span class="lineNum">     190 </span><span class="lineNoCov">          0 : class TypedBadConversion : public BadConversion {</span></a>
<span class="lineNum">     191 </span>            :  public:
<span class="lineNum">     192 </span><span class="lineNoCov">          0 :   explicit TypedBadConversion(const Mark&amp; mark_) : BadConversion(mark_) {}</span>
<span class="lineNum">     193 </span>            : };
<span class="lineNum">     194 </span>            : 
<span class="lineNum">     195 </span>            : class BadDereference : public RepresentationException {
<span class="lineNum">     196 </span>            :  public:
<span class="lineNum">     197 </span>            :   BadDereference()
<span class="lineNum">     198 </span>            :       : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
<a name="199"><span class="lineNum">     199 </span>            : };</a>
<span class="lineNum">     200 </span>            : 
<a name="201"><span class="lineNum">     201 </span><span class="lineNoCov">          0 : class BadSubscript : public RepresentationException {</span></a>
<span class="lineNum">     202 </span>            :  public:
<span class="lineNum">     203 </span><span class="lineNoCov">          0 :   BadSubscript()</span>
<span class="lineNum">     204 </span><span class="lineNoCov">          0 :       : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {}</span>
<a name="205"><span class="lineNum">     205 </span>            : };</a>
<span class="lineNum">     206 </span>            : 
<a name="207"><span class="lineNum">     207 </span><span class="lineNoCov">          0 : class BadPushback : public RepresentationException {</span></a>
<span class="lineNum">     208 </span>            :  public:
<span class="lineNum">     209 </span><span class="lineNoCov">          0 :   BadPushback()</span>
<span class="lineNum">     210 </span><span class="lineNoCov">          0 :       : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}</span>
<a name="211"><span class="lineNum">     211 </span>            : };</a>
<span class="lineNum">     212 </span>            : 
<a name="213"><span class="lineNum">     213 </span><span class="lineNoCov">          0 : class BadInsert : public RepresentationException {</span></a>
<span class="lineNum">     214 </span>            :  public:
<span class="lineNum">     215 </span><span class="lineNoCov">          0 :   BadInsert()</span>
<span class="lineNum">     216 </span><span class="lineNoCov">          0 :       : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}</span>
<span class="lineNum">     217 </span>            : };
<span class="lineNum">     218 </span>            : 
<span class="lineNum">     219 </span>            : class EmitterException : public Exception {
<span class="lineNum">     220 </span>            :  public:
<span class="lineNum">     221 </span>            :   EmitterException(const std::string&amp; msg_)
<span class="lineNum">     222 </span>            :       : Exception(Mark::null_mark(), msg_) {}
<a name="223"><span class="lineNum">     223 </span>            : };</a>
<span class="lineNum">     224 </span>            : 
<a name="225"><span class="lineNum">     225 </span><span class="lineNoCov">          0 : class BadFile : public Exception {</span></a>
<span class="lineNum">     226 </span>            :  public:
<span class="lineNum">     227 </span><span class="lineNoCov">          0 :   BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}</span>
<span class="lineNum">     228 </span>            : };
<span class="lineNum">     229 </span>            : }
<span class="lineNum">     230 </span>            : 
<span class="lineNum">     231 </span>            : #endif  // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.11</a></td></tr>
  </table>
  <br>

</body>
</html>
